{extend name="admin@public/base" /}
{block name="main-content"}
<div class="page-content">
    <div class="row maintop">
        <form name="admin_list_sea" class="form-search" method="post" action="{:url('admin/Admin/admin_list')}">
            <div class="col-xs-12 col-sm-12 maintop">
                <div class="col-xs-8 col-sm-8" style="float:left">
                    <div class="input-group">
                        <select name="company_type" class="ajax_change">
                            <option value="">公司类别</option>
                            {foreach name="org_type" key="k" item="v"}
                            <option value="{$k}" {if condition="$company_type eq $k"}selected{/if} >{$v}</option>
                            {/foreach}
                        </select>
                        <select name="isvalid" class="ajax_change">
                            <option value="">状态</option>
                            <option value="1" <?php if($isvalid==='1'){ ?>selected<?php } ?>>启用</option>
                            <option value="0" <?php if($isvalid==='0'){ ?>selected<?php } ?> >禁用</option>
                        </select>
                        <select name="position" class="ajax_change">
                            <option value="">职务</option>
                            {foreach name="position_list" item="v"}
                            <option value="{$v.id}" {if condition="$position eq $v.id"}selected{/if} >{$v.name}</option>
                            {/foreach}
                        </select>
                        <div class="col-xs-4 col-sm-4 input-group" style="float:left">
                            员工姓名：
                            <input type="text" name="search_name" style ="width:65%" id="search_name" class="search-query admin_sea" value="{$search_name}" placeholder="输入需查询的关键字" />
                        </div>
                        <span class="input-group-btn">
                            <button type="submit" class="btn btn-xs btm-input btn-purple">
                                <span class="ace-icon fa fa-search icon-on-right bigger-110 ajax-search-form"></span>
                                搜索
                            </button>
                        </span>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <span class="input-group-btn">
                    <a href="{:url('admin/Admin/admin_add')}" class="btn btn-xs btn-danger ruleadd">
                        <span class="ace-icon glyphicon glyphicon-plus icon-on-right bigger-110"></span>
                        添加用户
                    </a>
                </span>
            </div>
        </form>
    </div>

    <div class="row">
        <div class="col-xs-12">
            <div>
                <form id="leftnav" name="leftnav" method="post" action="" >
                    <input type="hidden" name="checkk" id="checkk" value="1" /><!--用于判断操作类型-->
                    <ul class="nav nav-tabs">
                        <li class="{eq name='$company_type' value='1'}active{/eq}"><a href="{:url('admin/Admin/admin_list',array('company_type'=>1))}">总店</a></li>
                        <li class="{eq name='$company_type' value='2'}active{/eq}"><a href="{:url('admin/Admin/admin_list',array('company_type'=>2))}">加盟商</a></li>
                    </ul>
                    <table class="table table-striped table-bordered table-hover" id="dynamic-table">
                        <thead>
                            <tr>
                                <th class="center hidden-sm hidden-xs">编号</th>
                                <th class="center">登录用户名</th>
                                <th class="center">真实姓名</th>
                                <th class="center hidden-sm hidden-xs">手机号码</th>
                                <th class="center">职务</th>
                                <th class="center">所属用户组</th>
                                <th class="center">所属公司</th>
                                <th class="center">所属部门</th>
                                <th class="center hidden-sm hidden-xs">最近登陆时间</th>
                                <th class="center">状态</th>
                                <th class="center hidden-sm hidden-xs" style="border-right:#CCC solid 1px;">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {empty name="admin_list"}
                            <tr> <td colspan="12" class="center">未查询到相关数据  </td> </tr>
                            {else /}
                            {foreach name="admin_list" item="v"}
                            <tr>
                                <td class="center hidden-sm hidden-xs">{$v.id}</td>
                                <td class="center">{$v.user_name}</td>
                                <td class="center">{$v.name}</td>
                                <td class="center hidden-sm hidden-xs">{$v.phone}</td>
                                <td class="center"><?php echo (isset($v['position_name'])&&!empty($v['position_name']))?$v['position_name']:'暂无'; ?></td>
                                <td class="center">
                                    {empty name="$v.id|get_groups"}
                                    暂无
                                    {else /}
                                    {foreach name="$v.id|get_groups" item="a"}
                                    {$a.title}<br>
                                    {/foreach}
                                    {/empty}
                                </td>
                                <td class="center">{$v.company_name}</td>
                                <td class="center">{empty name="$v.dept_name"}暂无{else /}{$v.dept_name}{/empty}</td>
                                <td class="center hidden-sm hidden-xs"><?php echo (isset($v['last_login_time'])&&!empty($v['last_login_time']))?date('Y-m-d',$v['last_login_time']):'暂无'; ?></td>
                                <td class="center">
                                    {if condition="$v['isvalid'] eq 1"}
                                    <a class="red open-btn" href="{:url('admin/Admin/admin_state')}" data-id="{$v.id}" title="已开启">
                                        <div id="zt{$v.id}"><button class="btn btn-minier btn-yellow">开启</button></div>
                                    </a>
                                    {else/}
                                    <a class="red open-btn" href="{:url('admin/Admin/admin_state')}" data-id="{$v.id}" title="已禁用">
                                        <div id="zt{$v.id}"><button class="btn btn-minier btn-danger">禁用</button></div>
                                    </a>
                                    {/if}
                                </td>
                                <td class ="center hidden-sm hidden-xs">
                                    <div class="hidden-sm hidden-xs action-buttons">
                                        <a class="green" href="{:url('admin/Admin/admin_edit',array('id'=>$v['id']))}" title="编辑">
                                            <i class="ace-icon fa fa-pencil-square-o bigger-110"></i> 编辑															
                                        </a>
                                        {if condition="$v['id'] neq 1"}
                                        <a class="blue confirm-rst-url-btn" data-info="你确定要重置密码？" href="{:url('admin/Admin/password_reset',array('id'=>$v['id']))}" title="重置密码">
                                            <i class="ace-icon fa  fa-cogs bigger-110"></i> 重置密码

                                        </a>
                                        {/if}
                                        <?php
                                        $secret_key = md5($v['id'].'_'.$login_token.'_'.$url_time);
                                        ?>
                                        <a class="red" href="{:url('admin/Login/runloginUrl',array('user_id'=>$v['id'],'url_time'=>$url_time,'secret_key'=>$secret_key))}" data-rel="tooltip" data-original-title="登录">
                                            <i class="ace-icon fa fa-laptop bigger-110"></i> 登录
                                        </a>
                                    </div>
                                </td>
                            </tr>
                            {/foreach}
                            {/empty}
                            {notempty name="$page"}
                            <tr>
                                <td height="50" colspan="12" align="left">{$page}</td>
                            </tr>
                            {/notempty}
                        </tbody>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div><!-- /.page-content -->
{/block}